package com.zbbt.sportslottery.ui.adapter;

import java.util.ArrayList;
import java.util.List;

import com.zbbt.sportslottery.R;
import com.zbbt.sportslottery.bean.AwardNoticeNewDetail;
import com.zbbt.sportslottery.bean.BallDataBean;
import com.zbbt.sportslottery.util.LogUtil;

import android.content.Context;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class DrawDetailAdapter extends BaseAdapter {
	private LayoutInflater inflater;
	private String[] number;
	private String[] money;
	private String[] name;
	private int type;
	private Context context;

	public DrawDetailAdapter(Context context, String[] name, String[] number, String[] money, int type) {
		this.number = number;
		this.money = money;
		this.name = name;
		this.type = type;
		this.context = context;
		inflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return name.length;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		Holder holder;
		if (type == 3) {
			if (null == convertView) {
				holder = new Holder();
				convertView = inflater.inflate(R.layout.item_activity_drawdetail, null); // mContext指的是调用的Activtty
				holder.textView1 = (TextView) convertView.findViewById(R.id.textview1);
				holder.textView2 = (TextView) convertView.findViewById(R.id.textview2);
				holder.textView3 = (TextView) convertView.findViewById(R.id.textview3);
				holder.bottom_line=(View)convertView.findViewById(R.id.bottom_line);
				convertView.setTag(holder);
			} else {
				holder = (Holder) convertView.getTag();
			}
			holder.textView1.setText(name[position]);
			holder.textView1.setTextSize(13);
			String notesum="";
			if (number[position].contains("注")) {
				notesum = number[position].replace("注", "");
			}else {
				notesum=number[position];
			}
			holder.textView2.setText(notesum);
			String notebouns="";
			if (money[position].contains("元")) {
				notebouns = money[position].replace("元", "");
			}else {
				notebouns=money[position];
			}
			holder.textView3.setText(notebouns);
			holder.textView3.setTextColor(context.getResources().getColor(R.color.red));
//			if(position==number.length-1){
//				holder.bottom_line.setVisibility(View.VISIBLE);
//			}
		} else if (type == 2) {
			if (null == convertView) {
				holder = new Holder();
				convertView = inflater.inflate(R.layout.item_activity_drawdetail2, null); // mContext指的是调用的Activtty
				holder.textView1 = (TextView) convertView.findViewById(R.id.textview1);
				holder.textView2 = (TextView) convertView.findViewById(R.id.textview2);
				holder.bottom_line=(View)convertView.findViewById(R.id.bottom_line);
				convertView.setTag(holder);
			} else {
				holder = (Holder) convertView.getTag();
			}
			holder.textView1.setText(name[position]);
			holder.textView2.setText(money[position]);
//			if(position==name.length){
//				holder.bottom_line.setVisibility(View.VISIBLE);
//			}
		}
		return convertView;
	}

	class Holder {
		public TextView textView1;
		public TextView textView2;
		public TextView textView3;
		public  View bottom_line;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

}
